package com.aeye.mbr.common.base.constants;

public enum UserType {
	//所属类型：1机构， 2 单位，3居住地，4银行 ，5医院，9第三方用户
	INST(1,"机构"),
	UNIT(2,"单位"),
	RESIDENCE(3,"居住地"),
	BANK(4,"银行"),
	HOSPITAL(5,"医院"),
	SCHOOL(6,"培训机构"),
	TOOL(7,"辅助器具"),
	THIRD(9,"第三方"),
	MEDICARE(10,"医保"),
	Access(11,"接入用户"),
	EDU(8,"教育机构");
	private UserType(int code,String name){
		this.code = code;
		this.name = name;
	}
	
	int code;
	String name;
	public int getCode() {
		return code;
	}
	public String getName() {
		return name;
	}
	
	public static UserType initUserType(String code){
		return initUserType(Integer.valueOf(code));
	}
	
	public static UserType initUserType(int code){
		UserType[]  userTypes = UserType.values();
		for(UserType userType :userTypes ){
			if(code == userType.getCode()){
				return userType;
			}
		}
		return null;
	}
	
}
